Expression Translator (EXTRA)
To access this screen:
-
Run the EXTRA process from the command line by typing 'extra'. Specify an input file, output file and (optionally) retrieval criteria and click OK - the Expression Translator displays.
For more information on the EXTRA process, see EXTRA.
Entering Expressions
Logical expressions can be entered using either (or both) of the following methods:
-
Type the expression you want directly into the Expression field.
-
Construct an expression by selecting various parameter components, such as field names, operations, functions and procedures.
For examples and further guidance on using expressions in Studio products, see EXTRA Syntax Checker.
To define a logical expression for the EXTRA process:
-
Enter all or part of a logical expression into the Expression field.
-
To add preformatted text to the current cursor position (in the Expression field):
-
Add one or more input Fields to the expression using the list provided. The fields are derived from the IN file of the EXTRA process.
-
Add one of the Operators to the expression using the buttons provided:
==
equal to
!=
not equal to
<
less than
<=
less than or equal to
>
greater than
>=
greater than or equal to
-
Choose from any of the available Functions and Procedures, categorized into Numeric Functions, String Functions, Procedures and Record Selection functions:
-
Numeric Functions are used to perform mathematical functions on explicit or data-stored values, including:
Function name
Arguments
Returns
abs
X
The absolute (positive) value of X
absent
none
The Datamine "absent data" value
acos
X
The angle whose cosine is X
asin
X
The angle whose sine is X
atan
X
The angle whose tangent is X
cos
X
The cosine of X
exp
X
The constant "e" raised to the power of X
int
X
The integer part of X
log
X
The base-10 logarithm of X
loge, logn
X
The base-"e" logarithm of X
max
X1, X2, X3, ...
The maximum value of X1, X2, X3, ...
maxia
X1, X2, X3, ...
The maximum value of X1, X2, X3, ... ignoring absent arguments.
min
X1, X2, X3, ...
The minimum value of X1, X2, X3, ... ignoring absent arguments.
For example:
- minia(absent(), 100, 2) = 2
- min(absent(), 100, 2) = absent)
minia
X1, X2, X3, ...
The minimum value of X1, X2, X3, ...
mod, modc
X, Y
The remainder when X is divided by Y
phi
X
The inverse normal distribution function
pow, rais
X, Y
The value of X raised to the power of Y
round
X, Y
Round off the value X to the nearest multiple of Y. Equivalent to Y*int(X/Y + 0.5)
sin
X
The sine of X
special
X
One of your application's "special" values (see below)
sqrt
X
The square root of X
tan
X
The tangent of X
-
String Functions can be applied to alphanumeric values, including:
Function name
Arguments
Returns
decode
A
The numeric value of the first set of numeric characters embedded in A
field
F1
The contents of a field. The field name must be supplied as a string - for example, field ("AU"). This allows field names with otherwise prohibited characters, such as '-', to be referenced. This function can only be used for getting the value of a field - not for setting it.
join
A1, A2, A3, ...
The concatenation of the alphanumeric values A1, A2, A3, ...
lcase
A
Returns the string given as an argument, with all upper case letters converted to lower case
len
A
The length (up to the first trailing space) of A
match
A, P
The position where a regular expression P matches characters in A
string
N, M
The numeric value N, converted to a string with M decimals. If M is omitted, the function uses a general-purpose numeric format.
substr
A, N, M
Returns a sub-string, consisting of M characters taken from A, starting with character N. If M is omitted, all characters from N to the end are returned.
trim
A
Returns the value of A with trailing spaces removed
ucase
A
Returns the string given as an argument, with all lower case letters converted to upper case
-
Proceduresunlike functions, don't return a value. They just carry out an action. EXTRA provides the following procedures:
Procedure
Arguments
Description
erase
F1, F2, F3, ...
Erases the fields F1, F2, F3, ... from the output file
saveonly
F1, F2, F3, ...
Erases all fields except F1, F2, F3, ... from the output file. If used more than once, only the values in the last saveonly are honoured.
delete
none
Deletes the current record
-
Record Selection functions allow you to navigate throughout the specified IN database. They include:
Function name
Arguments
Returns
first
none
If processing the first record, returns 1.0, otherwise returns 0.0
last
none
If processing the last record, returns 1.0, otherwise returns 0.0
prev
X
The value of field X from the previous record
next
X
The value of field X from the next record
-
-
-
Click the respective Add button to transfer preformatted text to the Expression field.
-
Test the validity of your expression. You are told if the expression is valid ("OK") or not.
If a syntax error occurs, the Status field indicates which line is problematic.
Note: to restart your expression, use Clear. You can't undo this.
-
Execute your expression using the EXTRA process.
Related topics and activities
-
EXTRA (process)